
import { httpGet } from "../../autox/http";
import { updateFloat } from "../../utils";
import { IScheduleTask } from "../node";

export class KwaiNebulaYangJiSheduleTask implements IScheduleTask {
    time: number = 1000 * 60;
    title: string = `[休息]`;
    isRuning: boolean = false;
    count: number = 25;
    check(): boolean {
        return true;
    }
    start(): void {
        if (this.isRuning) {
            updateFloat({ toast: `${this.title}已经执行` })
            return;
        }
        this.isRuning = true;
        updateFloat({ toast: `正在执行${this.title}任务`, currentTask: this.title })
        let i = this.time / 1000;
        while (this.isRuning) {
            i -= 1;
            // 从服务器获取关注列表
            updateFloat({ toast: `正在执行${this.title}任务，剩余${i}s`, currentTask: this.title })
            sleep(1000)
        }
    }
    stop(): void {
        this.isRuning = false;
        updateFloat({ toast: `${this.title}任务执行结束`, currentTask: this.title })
    }
}